#!/bin/bash
#
# Run this script once on your build hosts


set -e

if [[ -f build.config ]]; then
  source ./build.config
else
  echo ERROR: ./build.config not found.
  exit 1
fi

# Fail on empty params
if [[ -z ${REPO} || -z ${IMAGE_NAME} || -z ${IMAGE_VERSION} ]]; then
  echo ERROR: Please set build parameters.
  exit 1
fi

mkdir -p ../${REPO}/${IMAGE_NAME}-${IMAGE_VERSION}
./init-repo.sh ../${REPO}/${IMAGE_NAME}-${IMAGE_VERSION}

cd ../${REPO}/${IMAGE_NAME}-${IMAGE_VERSION}


# ./build.sh